package com.laowang.serviceImpl;

import com.laowang.dataoject.ProductCategory;
import com.laowang.repository.ProductCategoryRepository;
import com.laowang.sercice.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * Created by Administrator on 2019/1/9.
 */
@Service
public class CategoryServiceImpl implements CategoryService{
    @Autowired
    private ProductCategoryRepository repository;
    @Override
    public Optional<ProductCategory> findById(Integer id) {
        Optional<ProductCategory> byId = repository.findById(id);
        return byId;
    }

    @Override
    public List<ProductCategory> findAll() {
        return repository.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categoryTypeList) {
        return repository.findByCategoryTypeIn(categoryTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return repository.save(productCategory);
    }
}
